package com.huawei.gamebox.service.welfare.gift.card;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.gamebox.service.common.cardkit.bean.BaseGsCardBean;
import com.huawei.gamebox.service.common.cardkit.card.BaseGsCard;
import com.huawei.gamebox.service.welfare.common.card.GsTitleCard;
import com.huawei.gamebox.service.welfare.gift.bean.SimpleItemsCardBean;
import java.util.List;
import o.cgz;
import o.evx;
import o.exp.j;
import o.eys;

public class SimpleItemsCard extends BaseGsCard {
    private LinearLayout ˏ;
    private GsTitleCard ॱ = null;

    public SimpleItemsCard(Context context) {
        super(context);
    }

    public GsTitleCard ˋ() {
        return this.ॱ;
    }

    public void ˊ(GsTitleCard gsTitleCard) {
        this.ॱ = gsTitleCard;
    }

    public cgz ˏ(View view) {
        if (view instanceof LinearLayout) {
            this.ˏ = (LinearLayout) view;
        }
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        if ((cardBean instanceof SimpleItemsCardBean) && this.ˏ != null) {
            if (this.ॱ != null) {
                this.ॱ.ˏ(cardBean);
            }
            this.ˏ.removeAllViews();
            List ˊ = ((SimpleItemsCardBean) cardBean).ˊ();
            if (ˊ != null && ˊ.size() != 0) {
                int size = ˊ.size();
                int i = 0;
                while (i < size && i + 1 <= 3) {
                    final TextView textView = (TextView) LayoutInflater.from(this.ʼॱ).inflate(j.ᶥ, null);
                    final BaseGsCardBean baseGsCardBean = (BaseGsCardBean) ˊ.get(i);
                    textView.setText(baseGsCardBean.v_());
                    textView.setTag(baseGsCardBean);
                    textView.setOnClickListener(new evx(this) {
                        final /* synthetic */ SimpleItemsCard ˎ;

                        public void ˋ(View view) {
                            this.ˎ.ʽ().onClick(textView);
                            eys.ˏ(baseGsCardBean.ͺˏ(), "GIFTS", baseGsCardBean.ॱॱ());
                        }
                    });
                    this.ˏ.addView(textView);
                    i++;
                }
            }
        }
    }
}
